

class MySourceChoose:
    def __init__(self):
        self.source_path = ''
        self.source_all = []

    def choose_source(self, source_name):
        if source_name == "Source":
            self.source_path = ''
            return
        elif source_name == "BEEP":
            self.source_path = './Source/BEEP.c'
        elif source_name == "BEEP_PWM":
            self.source_path = './Source/BEEP_PWM.c'
        elif source_name == "Button":
            self.source_path = './Source/Button.c'
        elif source_name == "CP601_2.4G":
            self.source_path = './Source/CP601_2.4G.c'
        elif source_name == "DS1302":
            self.source_path = './Source/DS1302.c'
        elif source_name == "I2C":
            self.source_path = './Source/I2C.c'
        elif source_name == "IR":
            self.source_path = './Source/IR.c'
        elif source_name == "IR_LongDown":
            self.source_path = './Source/IR_LongDown.c'
        elif source_name == "IR_RX_TX(LongDown)":
            self.source_path = './Source/IR_RX_TX(LongDown).c'
        elif source_name == "LIS3DH(加速度传感器)":
            self.source_path = './Source/LIS3DH(加速度传感器).c'
        elif source_name == "LSM6DS3TR(陀螺仪)":
            self.source_path = './Source/LSM6DS3TR(陀螺仪).c'
        elif source_name == "Scan":
            self.source_path = './Source/Scan.c'
        elif source_name == "Soft_Single_TwoWay":
            self.source_path = './Source/Soft_Single_TwoWay.c'
        elif source_name == "SPI_3Line":
            self.source_path = './Source/SPI_3Line.c'
        elif source_name == "SPI_4Line":
            self.source_path = './Source/SPI_4Line.c'
        elif source_name == "TM1620":
            self.source_path = './Source/TM1620.c'
        elif source_name == "TM1621":
            self.source_path = './Source/TM1621.c'
        elif source_name == "TM1640":
            self.source_path = './Source/TM1640.c'
        elif source_name == "TM1650":
            self.source_path = './Source/TM1650.c'
        elif source_name == "TM1668":
            self.source_path = './Source/TM1668.c'
        elif source_name == "TwoLine_TwoWay":
            self.source_path = './Source/TwoLine_TwoWay.c'
        elif source_name == "Wifi_Mode":
            self.source_path = './Source/Wifi_Mode.c'
        else:
            self.source_path = ''
            return

        with open(self.source_path, 'r') as file:
            self.source_all = file.read()
        self.source_path = ''
        # print(self.source_all)  #测试